package com.example.m5;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Scanner;

@Component
public class Producer {
    @Autowired
    private AmqpTemplate amqpTemplate;
    public void send(){
        while (true){
            System.out.println("enter:");
            String s=new Scanner(System.in).nextLine();
            System.out.println("enter route:");
            String key=new Scanner(System.in).nextLine();
//          队列名 ， 路由 ，msg
            amqpTemplate.convertAndSend("topic_logs",key,s);
        }

    }
}
